import React, { useEffect, useState } from 'react'

// 导入 Antd UI 依赖
import { ConfigProvider } from 'antd'
import zhCN from 'antd/locale/zh_CN'
import { theme1, theme2 } from '@renderer/theme'

// 导入 Redux 依赖
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'
import { persistor, store } from '@renderer/redux/index'

// 导入 React Router 依赖
import { RouterProvider } from 'react-router-dom'
import router from '@renderer/router/index'

function App(): JSX.Element {
  const [theme, setTheme] = useState(theme2)

  // useEffect(() => {
  //   setTimeout(() => {
  //     setTheme(theme2)
  //   }, 1000 * 10)
  // }, [])

  return (
    <React.StrictMode>
      <ConfigProvider locale={zhCN} theme={theme}>
        <Provider store={store}>
          <PersistGate loading={null} persistor={persistor}>
            <RouterProvider router={router}></RouterProvider>
          </PersistGate>
        </Provider>
      </ConfigProvider>
    </React.StrictMode>
  )
}

export default App
